package aiku.numericalcontroloa.Controller.DepartmentManagement;

import aiku.numericalcontroloa.Base.Utils.Result;
import aiku.numericalcontroloa.Model.Dto.DepartmentManagement.EmployeeDepartmentDto;
import aiku.numericalcontroloa.Service.DepartmentManagement.EmployeeDepartmentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 黄广庭
 * @Date 2024/2/22 13:39
 */
@RestController
@RequestMapping("/employeeDepartment")
@Slf4j
public class EmployeeDepartmentController {
    private final EmployeeDepartmentService employeeDepartmentService;

    public EmployeeDepartmentController(EmployeeDepartmentService employeeDepartmentService) {
        this.employeeDepartmentService = employeeDepartmentService;
    }

    /**
     * 批量添加部门人员记录
     * @param employeeDepartmentDto
     * @return
     */
    @PostMapping("/addEmployeeDepartmentList")
    public Result addEmployeeDepartmentList(@RequestBody EmployeeDepartmentDto employeeDepartmentDto){
        return employeeDepartmentService.addEmployeeDepartmentList(employeeDepartmentDto);
    }

    /**
     * 批量删除部门人员记录
     * @param employeeDepartmentDto
     * @return
     */
    @PostMapping("/deleteEmployeeDepartmentList")
    public Result deleteEmployeeDepartmentList(@RequestBody EmployeeDepartmentDto employeeDepartmentDto){
        return employeeDepartmentService.deleteEmployeeDepartmentList(employeeDepartmentDto);
    }

    /**
     * 根据部门id查询部门人员
     * @param employeeDepartmentDto
     * @return
     */
    @PostMapping("/getEmployeeDepartmentList")
    public Result getEmployeeDepartmentList(@RequestBody EmployeeDepartmentDto employeeDepartmentDto){
        return employeeDepartmentService.getEmployeeDepartmentList(employeeDepartmentDto);
    }
}
